package com.demo.service.his;

import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.flowable.engine.delegate.DelegateExecution;
import org.springframework.stereotype.Component;

/**
 * 病历报告
 * @author K
 */
@Slf4j
@Component
public class ReportService {

    public void exec(DelegateExecution execution) {
        String diagnosis = execution.getVariable("diagnosis", String.class);
        String complaints = execution.getVariable("complaints", String.class);

        if (StringUtils.equals(diagnosis, "新冠")) {
            String treatment = execution.getVariable("treatment", String.class);
            log.info("病历报告，主诉：{}；诊断结果：{}；治疗：{}", complaints, diagnosis, treatment);
        } else {
            String medicine = execution.getVariable("medicine", String.class);
            log.info("病历报告，主诉：{}；诊断结果：{}；用药：{}", complaints, diagnosis, medicine);
        }
    }
}
